﻿<Window x:Class="LifeV2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Model="clr-namespace:LifeV2.Model" xmlns:Skins="clr-namespace:LifeV2.Skins" Title="MainWindow" DataContext="{Binding Main, Source={StaticResource Locator}}" SizeToContent="WidthAndHeight">

	<Window.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="Skins/MainSkin.xaml" />
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</Window.Resources>


	<Grid x:Name="LayoutRoot">

		<DockPanel LastChildFill="False">
			<Border DockPanel.Dock="Right" BorderBrush="Black" BorderThickness="1" Margin="3">

				<DockPanel Margin="5">
					<TextBlock TextWrapping="Wrap" DockPanel.Dock="Top" HorizontalAlignment="Center"><Run Text="LifeForm Details"/></TextBlock>
					<StackPanel Orientation="Vertical" Width="120" VerticalAlignment="Top">
                        <ComboBox Margin="0,5" ItemsSource="{Binding LifeFormTypes}" SelectedIndex="0" SelectedItem="{Binding SelectedLifeType}" >
                            <ComboBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Name}"/>
                                </DataTemplate>
                            </ComboBox.ItemTemplate>
                        </ComboBox>
                    </StackPanel>
				</DockPanel>
			</Border>
			<Border DockPanel.Dock="Bottom" BorderThickness="1" BorderBrush="Black" Margin="3">

				<DockPanel Margin="5">
					<TextBlock TextWrapping="Wrap" Text="Simulation Control" VerticalAlignment="Top" DockPanel.Dock="Top" HorizontalAlignment="Center"/>
					<UniformGrid HorizontalAlignment="Center" VerticalAlignment="Center" Rows="1" Margin="0">
						<Button Content="Start" Command="{Binding StartCommand}" Width="75" Height="25" Padding="2,0,2,1" Margin="5,0"/>
						<Button Content="Stop" Command="{Binding StopCommand}" Width="75" Height="25" Padding="5,0,5,1" Margin="5,0"/>
						<Button Content="Reset" Command="{Binding ResetCommand}" Width="75" Height="25" Padding="5,0,5,1" Margin="5,0"/>
					</UniformGrid>
				</DockPanel>

			</Border>

			<ItemsControl ItemsSource="{Binding World.LifeMatrix}" ItemTemplate="{StaticResource LifeFormTemplate}" HorizontalAlignment="Left" VerticalAlignment="Top">
				<ItemsControl.ItemsPanel>
					<ItemsPanelTemplate>
						<UniformGrid Columns="{Binding World.Width}" Rows="{Binding World.Height}" IsItemsHost="True" />
					</ItemsPanelTemplate>
				</ItemsControl.ItemsPanel>
			</ItemsControl>


		</DockPanel>
	</Grid>
</Window>